package com.bwie.controller;

import com.bwie.pojo.Orders;
import com.bwie.pojo.ServiceItem;
import com.bwie.pojo.ServiceType;
import com.bwie.service.ServiceItemService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import com.bwie.vo.PageVo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * description:
 *
 * @Author zhaohaoyang
 * @Create 2025/7/11 11:04
 * @Version 1.0
 */
@RestController
@RequestMapping("/service/index")
public class IndexController {
    @Autowired
    ServiceItemService serviceItemService;

    /**
     * 服务分页列表
     * @param pageVo
     * @return
     */
    @PostMapping("/getServiceItemList")
    public R getServiceItemList(@RequestBody PageVo pageVo){
        return serviceItemService.getServiceItemList(pageVo);
    }

    /**
     * 添加服务
     * @param serviceItem
     * @return
     */
    @PostMapping("/addServiceItem")
    public R addServiceItem(@RequestBody ServiceItem serviceItem){
        return serviceItemService.addServiceItem(serviceItem);
    }

    /**
     * 获取服务类型
     * @return
     */
    @PostMapping("/getServiceType")
    public R getServiceType(){
        return serviceItemService.getServiceType();
    }

    /**
     * 图片上传
     * @param file
     * @return
     */
    @PostMapping("/uploadFile")
    public R uploadFile(@RequestPart("file")MultipartFile file){
        return serviceItemService.uploadFile(file);
    }

    /**
     * 优惠券列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getCouponList")
    public R getCouponList(@RequestBody PageInfoVo pageInfoVo){
        return serviceItemService.getCouponList(pageInfoVo);
    }

    /**
     * 预约服务类型
     * @param serviceType
     * @return
     */
    @PostMapping("/updateTypeStatus")
    public R updateTypeStatus(@RequestBody ServiceType serviceType){
        return serviceItemService.updateTypeStatus(serviceType);
    }

    /**
     * 预约服务
     * @param order
     * @return
     */
    @PostMapping("/makeOrder")
    public R makeOrder(@RequestBody Orders order){
        return serviceItemService.makeOrder(order);
    }


}
